import {defineConfig} from '@umijs/max';
import proxy from "./proxy";
import routesConfig from './router';

export default defineConfig({
    // https://umijs.org/docs/guides/env-variables#%E5%9C%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F
    // 约定所有以 UMI_APP_ 开头的环境变量会默认注入到浏览器中，无需配置 define 手动注入
    define: {
        // API TOKEN NAME
        'process.env.TOKEN_NAME': process.env.TOKEN_NAME || 'token',
        // WEB localStorage NAME
        'process.env.TOKEN_LOCAL_STORAGE_NAME': process.env.TOKEN_LOCAL_STORAGE_NAME || 'ms-token',
        // SYS NAME
        'process.env.SYSTEM_NAME': process.env.SYSTEM_NAME || '运维系统',
        // PUBLIC_URL https://www.yuque.com/tanning/dx3mgc/blvl5os2qsrmvv10#m8qCd
        'process.env.BASE_PATH': process.env.BASE_PATH || '/',
        // api prefix ，接口前缀[nginx代理的后端接口前缀] 注意要跟config/proxy.ts中的保持一致
        'process.env.API_PREFIX': process.env.API_PREFIX || '/ops-api',
        // 后端接口地址
        'process.env.API_URL': process.env.API_URL || 'http://127.0.0.1:8898',
    },
    // define: { "process.env": { ...process.env, }, },
    // base: process.env.BASE_PATH,
    publicPath: process.env.BASE_PATH,
    hash: true,
    proxy,
    history: {type: 'hash'},
    routes: routesConfig,
    antd: {}, // 开启antd
    access: {}, // 开启权限
    icons: {autoInstall: {}}, // 开启图标 https://umijs.org/docs/api/config#icons
    model: {}, // 开启数据流 -> 替代dva
    initialState: {}, // 全局初始化
    request: {}, // 开启请求
    // mock: false, // 关闭mock
    layout: {
        // 开启全局布局
        title: process.env.SYSTEM_NAME,
    },
    npmClient: 'npm',
});
